import reshandler from 'services/response-handler'
/*
 * 计算订单价格
 */
function makeData(response) {
  return Object.assign({}, response, {
    amount: response.amount || "0.00",
    amountPaid: response.amountPaid || "0.00",
    bean: response.bean || "0.00",
    discount: response.discount || "0.00",
    freight: response.freight || "0.00",
    invoice: response.invoice || "0.00"
  })
}
export default function (params, success, fail) {
  // request 
  params = Object.assign({}, params, {
    methodName: "CalculateOrder",
  })

  // invoke
  this.$.get(params)
    .then(reshandler.success(success, fail, makeData), reshandler.error(fail))
}
